﻿<div class="ld-tabs">
    <ul>
        <li class="k-state-active">任职查询记录</li>
    </ul>
    <div>
        <div id="grid_employees" style="text-align: center"></div>
    </div>
</div>

<script class="grid_employees_columns">
    var fields = [{
        title: "员工姓名",
        field: "EmployeeName",
        width: 100
    }, {
        title: "岗位",
        field: "Post",
        width: 100
    }, {
        title: "查询人姓名",
        field: "RealName",
        width: 100
    }, {
        title: "查询人手机",
        field: "Mobile",
        width: 100
    }, {
        title: "邮箱",
        field: "Email",
        width: 200
    }, {
        title: "日期",
        template: "#=kendo.toString(kendo.parseDate(CreatedOn),'yyyy-MM-dd')#",
        width: 100
    }, {
        title: "操作",
        template: "#=GetOperations(Guid)#",
        attributes: { style: "text-align:left" }
    }];

    function GetOperations(guid) {
        var html = "<button class='k-button' onclick=\"Send('" + guid + "')\"><span class='k-icon k-i-restore'></span><span>发送查询邮件</span></button>";
        return html;
    }

    function Send(guid) {
        if (confirm("真的要给他发送邮件吗?")) {
            Whale.Remote.Operation({
                url: "/Admin/Fun/SendEmployee",
                parameters: { guid: guid },
                success: function (result) {
                    wndGeneralInformation.content("已成功发送邮件。").open();
                },
                error: function (msg) {
                    wndGeneralInformation.content(msg).open();
                }
            });
        }
    }
</script>

<script class="grid_config">
    $(function () {
        $("#grid_employees").kendoGrid({
            columns: fields,
            dataSource: Whale.dataSource({
                url: "/Admin/Fun/GetEmployees",
                pageSize: 10
            }),
            pageable: {
                employees: {
                    empty: "暂无数据"
                }
            },
            dataBound: function (e) {
                //让表头居中
                $("th.k-header").attr("style", "text-align:center; font-weight:bold;");
            }
        });
    });

    function Filters() {
        $("#grid_employees").data("kendoGrid").dataSource.page(0);
    }
</script>
